package com.yf.openapi.modules.paper.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yf.base.api.api.ApiRest;
import com.yf.base.api.api.controller.BaseController;
import com.yf.base.api.api.dto.PagingReqDTO;
import com.yf.exam.modules.paper.dto.request.PaperListReqDTO;
import com.yf.exam.modules.paper.dto.response.PaperListRespDTO;
import com.yf.exam.modules.paper.service.PaperService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.web.bind.annotation.RequestMethod.POST;

@RestController
@Api(tags = {"成绩查询接口"})
public class OpenPaperController extends BaseController {

    @Autowired
    private PaperService paperService;


    @ApiOperation(value = "查询学员考试记录")
    @PostMapping("/api/open/paper/paging")
    public ApiRest<IPage<PaperListRespDTO>> paging(@RequestBody  PagingReqDTO< PaperListReqDTO > reqDTO) {
        IPage<PaperListRespDTO> data = paperService.paging(reqDTO);
        return success(data);
    }

    //cordwood获取学员成绩信息
    @RequestMapping(value = "/api/open/codewood/code_page" ,method = POST)
    public ApiRest<IPage<PaperListRespDTO>> cood_paging(@RequestBody  PagingReqDTO< PaperListReqDTO > reqDTO) {
        IPage<PaperListRespDTO> data = paperService.paging(reqDTO);
        return success(data);
    }

}
